import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

//  引入ant-d 先引入是因为想让el的覆盖
// import Antd from 'ant-design-vue'
// import 'ant-design-vue/dist/antd.css'
// Vue.use(Antd)

import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'


import Element from 'element-ui'
import './styles/element-variables.scss'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log

import * as filters from './filters' // global filters

import '@/assets/iconfont/iconfont.css'
import axios from 'axios'

Vue.prototype.$axios = axios

import VueNativeSock from 'vue-native-websocket'

console.log(process.env)
const WS_ADDRESS = `ws://${process.env.SCALE_WEBSOCKET_ADDRESS}` //  '192.168.2.194:8333'
Vue.use(VueNativeSock, WS_ADDRESS, {
  connectManually: true
})

import VuePreview from 'vue-preview'

Vue.use(VuePreview)

import VueBarcode from 'vue-barcode' // 导入条形码插件
Vue.use(VueBarcode)

import animated from 'animate.css' // npm install animate.css --save安装，在引入
Vue.use(animated)

import Print from 'vue-print-nb'
import { AzureSpeak } from '@/plugin/speakPlugin' // 导入打印插件
Vue.use(Print)
/**
 * If you don't want to use mock-server
 * you want to use mockjs for request interception
 * you can execute:
 *
 * import { mockXHR } from '../mock'
 * mockXHR()
 */

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

import vClickOutside from 'v-click-outside'

Vue.use(vClickOutside)

// main.js or index.js
// import InfiniteLoading from 'vue-infinite-loading';
// Vue.use(InfiniteLoading, { /* 配置 */ });

// @deprecated
//  挂载提示连接
// var conn = $.hubConnection(`${process.env.VUE_APP_BASE_API}/signalr`)
// var proxy = conn.createHubProxy('chatHub')
// proxy.on('showPrivateMessage', (userid, username, message, dt) => {
//   Element.Notification.info({
//     title: username + '发送消息',
//     message: message
//   })
// })

// 退出登录
// proxy.on('returnLogin', () => {
//   store.dispatch('user/logout')
//   //  window.location.href = "http://192.168.2.123:9527/login";
// })
// conn.start().done(function(data) {
//   proxy.invoke('serverQueryUinfoById', localStorage.getItem('userId'))
// })
//
// Vue.prototype.Conn = conn
// Vue.prototype.Proxy = proxy


Vue.use(AzureSpeak)

import BScroll from '@better-scroll/core'
import ScrollBar from '@better-scroll/scroll-bar'

//  scrollbar 插件为 BetterScroll 提供了样式美观的滚动条
BScroll.use(ScrollBar)
import MouseWheel from '@better-scroll/mouse-wheel'

BScroll.use(MouseWheel)

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false
Vue.performance = true
// const isDebug_mode = process.env.NODE_ENV !== 'production';
// Vue.config.debug = true;

import VueCompositionApi from '@vue/composition-api';
Vue.use(VueCompositionApi);

import { VuePlugin } from 'vuera'
Vue.use(VuePlugin)


import contentmenu from 'v-contextmenu'
import 'v-contextmenu/dist/index.css'

Vue.use(contentmenu)

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})

Vue.config.devtools = true
Vue.config.productionTip = false
